
testOptimizations([
	// a useless, empty block delimiter
	['{ }',
		''],
	
	// a useless block delimiter
	['{ b(); }',
		'b();'],
	
	// empty block inside block
	['{{}}',
		''],
	
	// inside a function:
	['function x() { a(!false); }',
		'function x() { a(true); }'],
	
	// inside a label:
	['label: while (b) while (d) { a(!false); if (c) break label; }',
		'label: while (b) while (d) { a(true); if (c) break label; }'],
	
	// inside a switch - case
	['switch (a) { case b: c(!false); }',
		'switch (a) { case b: c(true); }'],
	
	// inside a switch - default
	['switch (a) { case b: c(); default: c(!false); }',
		'switch (a) { case b: c(); default: c(true); }'],
	
	// parameter inside a function:
	['function a(b) { return !b; }',
		'function a(b) { return !b; }'],
	
	// variable inside a function:
	['function a() { var b; return !b; }',
		'function a() { var b; return true; }'],
	
	// overridden variable inside a function - can't optimize this
	['function a() { var b; b = c(); return !b; }',
		'function a() { var b; b = c(); return !b; }'],
	
	['"use strict"; "nop"; a();',
		'"use strict"; a();'],
	
	['"nop"; "use strict"; a()',
		'a();'],
	
	['function b() { "use strict"; c(); }',
		'function b() { "use strict"; c(); }'],
	
	['if (a) { "use strict"; a(); }',
		'a && a();'],
	
	// there was a bug which cauzed the optimizer to crash when processing this:
	['if (a()) { c(); true && 1; } else { b(); c(); }',
		// TODO: could be shorter and simpler:
		// a() && b(); c();
		'a() ? c() : (b(), c());'],
	
	['x(a() ? ((b() * c()), d()) : e());',
		'x(a() ? (b(), c(), d()) : e());'],
	
	['a + (2-1);',
		''],
	
	['a.b = 1;',
		'a.b = 1;'],
	
	['a.b.c = 1;',
		'a.b.c = 1;'],
	
	['a().b = 1;',
		'a().b = 1;'],
	
	['for (a in b) c(a);',
		'for (a in b) c(a);'],
	
	['if (a()) b = 1; if (!b) c();',
		'a() && (b = 1), !b && c();'],
	
	['(a = 1).value = 0;',
		'(a = 1).value = 0;'],
	
	['(!a).value = 0;',
		'(!a).value = 0;'],
	
	['(function() {}()).a = 1;',
		'(function() {})().a = 1;'],
	
	['function a() { var b; try { b = 0; c(); } catch (e) { b = 1; } if (b) d(); };',
		'function a() { var b; try { b = 0, c(); } catch (e) { b = 1; } b && d(); }'],
	
	// inside a selector:
	['a[1+2] = b[2+3];',
		'a[3] = b[5];'],
	
	// inside loop:
	['function a() { var i; for (i = 0; i < 10; i++) b(i+1); }',
		'function a() { var i; for (i = 0; i < 10; b(i + 1), i++) {} }']
	
]);
